home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / source.lha / Geomview / src / lib / gprim / discgrp / dgbound.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-19  |  1.8 KB  |  64 lines

  1. /* Copyright (c) 1992 The Geometry Center; University of Minnesota
  2.    1300 South Second Street;  Minneapolis, MN  55454, USA;
  3.    
  4. This file is part of geomview/OOGL. geomview/OOGL is free software;
  5. you can redistribute it and/or modify it only under the terms given in
  6. the file COPYING, which you should have received along with this file.
  7. This and other related software may be obtained via anonymous ftp from
  8. geom.umn.edu; email: software@geom.umn.edu. */
  9.  
  10. /* Authors: Charlie Gunn, Stuart Levy, Tamara Munzner, Mark Phillips */
  11.  
  12. #include "bboxP.h"
  13. #include "discgrpP.h"
  14.  
  15. BBox *
  16. DiscGrpBound(discgrp, T)
  17.     DiscGrp    *discgrp;
  18.     Transform T;
  19. {
  20.     register BBox *geombbox;
  21.     Transform Tnew, T2;
  22.     GeomIter *it;
  23.     Geom *geom;
  24.     int i, nels;
  25.  
  26.     if( discgrp == NULL)
  27.     return NULL;
  28.  
  29.     if (discgrp->geom == NULL)  return NULL;
  30.  
  31.     it = GeomIterate( (Geom *)discgrp, DEEP );
  32.     geombbox = NULL;
  33.  
  34.     /* this is a horrible hack to allow us to continue to fly around at
  35.      * reasonable speeds when in centercam mode, since the speed is
  36.      * proportional to the bbox of the world.  Solution: we only look
  37.      * at the identity element's bbox */
  38. #ifdef BADVELOCITY    /* strange flying mode velocity comps require this */
  39.     if (discgrp->attributes & DG_SPHERICAL || discgrp->flag & DG_CENTERCAM)    {
  40.         nels = discgrp->big_list->num_el;
  41.         discgrp->big_list->num_el = 1;
  42.     }
  43. #endif
  44.  
  45.     while(NextTransform(it, Tnew) > 0) {
  46.     register BBox *box;
  47.  
  48.     TmConcat( Tnew,  T, Tnew );
  49.     if((box = (BBox *)GeomBound( discgrp->geom, Tnew )) != NULL) {
  50.         if(geombbox) {
  51.         BBoxUnion3(geombbox, box, geombbox);
  52.         GeomDelete((Geom *)box);
  53.         } else
  54.         geombbox = box;
  55.     }
  56.     }
  57. #ifdef BADVELOCITY
  58.     if (discgrp->attributes & DG_SPHERICAL || discgrp->flag & DG_CENTERCAM)
  59.     discgrp->big_list->num_el = nels;
  60. #endif
  61.     return geombbox;
  62. }
  63.  
  64.